<%@ page import="minusjudge.Problem" %>



<div class="fieldcontain ${hasErrors(bean: problemInstance, field: 'title', 'error')} required">
	<label for="title">
		<g:message code="problem.title.label" default="Title" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="title" required="" value="${problemInstance?.title}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: problemInstance, field: 'memoryLimit', 'error')} required">
	<label for="memoryLimit">
		<g:message code="problem.memoryLimit.label" default="Memory Limit" />
		<span class="required-indicator">*</span>
	</label>
	<g:field name="memoryLimit" type="number" value="${problemInstance.memoryLimit}" required=""/>
</div>

<div class="fieldcontain ${hasErrors(bean: problemInstance, field: 'timeLimit', 'error')} required">
	<label for="timeLimit">
		<g:message code="problem.timeLimit.label" default="Time Limit" />
		<span class="required-indicator">*</span>
	</label>
	<g:field name="timeLimit" type="number" value="${problemInstance.timeLimit}" required=""/>
</div>

<div class="fieldcontain ${hasErrors(bean: problemInstance, field: 'stackLimit', 'error')} required">
	<label for="stackLimit">
		<g:message code="problem.stackLimit.label" default="Stack Limit" />
		<span class="required-indicator">*</span>
	</label>
	<g:field name="stackLimit" type="number" value="${problemInstance.stackLimit}" required=""/>
</div>

<div class="fieldcontain ${hasErrors(bean: problemInstance, field: 'numberOfTest', 'error')} required">
	<label for="numberOfTest">
		<g:message code="problem.numberOfTest.label" default="Number Of Test" />
		<span class="required-indicator">*</span>
	</label>
	<g:field name="numberOfTest" type="number" value="${problemInstance.numberOfTest}" required=""/>
</div>

<div class="fieldcontain ${hasErrors(bean: problemInstance, field: 'tipeChecker', 'error')} required">
	<label for="tipeChecker">
		<g:message code="problem.tipeChecker.label" default="Tipe Checker" />
		<span class="required-indicator">*</span>
	</label>
	<g:field name="tipeChecker" type="number" value="${problemInstance.tipeChecker}" required=""/>
</div>

<div class="fieldcontain ${hasErrors(bean: problemInstance, field: 'tokenSeparators', 'error')} ">
	<label for="tokenSeparators">
		<g:message code="problem.tokenSeparators.label" default="Token Separators" />
		
	</label>
	<g:textField name="tokenSeparators" value="${problemInstance?.tokenSeparators}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: problemInstance, field: 'statement', 'error')} required">
	<label for="statement">
		<g:message code="problem.statement.label" default="Statement" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="statement" required="" value="${problemInstance?.statement}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: problemInstance, field: 'author', 'error')} ">
	<label for="author">
		<g:message code="problem.author.label" default="Author" />
		
	</label>
	<g:textField name="author" value="${problemInstance?.author}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: problemInstance, field: 'contest', 'error')} required">
	<label for="contest">
		<g:message code="problem.contest.label" default="Contest" />
		<span class="required-indicator">*</span>
	</label>
	<g:select id="contest" name="contest.id" from="${minusjudge.Contest.list()}" optionKey="id" required="" value="${problemInstance?.contest?.id}" class="many-to-one"/>
</div>

<div class="fieldcontain ${hasErrors(bean: problemInstance, field: 'rootPath', 'error')} ">
	<label for="rootPath">
		<g:message code="problem.rootPath.label" default="Root Path" />
		
	</label>
	<g:textField name="rootPath" value="${problemInstance?.rootPath}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: problemInstance, field: 'solutions', 'error')} ">
	<label for="solutions">
		<g:message code="problem.solutions.label" default="Solutions" />
		
	</label>
	
<ul class="one-to-many">
<g:each in="${problemInstance?.solutions?}" var="s">
    <li><g:link controller="submission" action="show" id="${s.id}">${s?.encodeAsHTML()}</g:link></li>
</g:each>
<li class="add">
<g:link controller="submission" action="create" params="['problem.id': problemInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'submission.label', default: 'Submission')])}</g:link>
</li>
</ul>

</div>

<div class="fieldcontain ${hasErrors(bean: problemInstance, field: 'uploader', 'error')} required">
	<label for="uploader">
		<g:message code="problem.uploader.label" default="Uploader" />
		<span class="required-indicator">*</span>
	</label>
	<g:select id="uploader" name="uploader.id" from="${minusjudge.User.list()}" optionKey="id" required="" value="${problemInstance?.uploader?.id}" class="many-to-one"/>
</div>

